package com.wgj.android.ui.activity;
import android.app.ActivityManager;
import android.app.Dialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.jiaai.xui.view.widget.XAlertMsgDialog;
import com.jiaai.xui.view.widget.XLoadingDialog;
import com.wgj.android.R;
import com.wgj.android.accesslibility.config.WXConfginUtil;
import com.wgj.android.accesslibility.service.WGJAccessServier;
import com.wgj.android.accesslibility.service.WXShareAccesslibilityService;
import com.wgj.android.entity.Member;
import com.wgj.android.permission.WindowManagerPermission;
import com.wgj.android.utils.AccessibilityUtil;
import com.wgj.android.utils.CacheUtils;
import com.wgj.android.utils.SuUtil;

import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/11/10.
 */

public class ShareActivity extends AppCompatActivity {
    private Member member;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.share_activity);
        ButterKnife.bind(this);
        member= CacheUtils.getMember();
    }
    @OnClick({R.id.share1,R.id.share2})
    public void onShareClick(View view){
        if(!AccessibilityUtil.checkAccessibilityServiceIsOpen(this, WXShareAccesslibilityService.class)){
            new XAlertMsgDialog(this,"检测到旺旺通分享助手未打开,是否前往打开?").setPositiveButton("开启").setListener(new XAlertMsgDialog.OnCloseListener() {
                @Override
                public void onClick(Dialog dialog, boolean b) {
                    if(b){
                        Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
                        intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                        startActivity(intent);
                    }
                }
            }).show();
            return;
        }
        int type=0;
        if(view.getId()==R.id.share2){
            type=1;
        }
        Intent intent=new Intent(getApplication(),MyQrCodeActivity.class);
        intent.putExtra("type",type);
        startActivity(intent);
    }


    @OnClick(R.id.contactView)
    public  void  onContactClick(View view){
        Intent intent=new Intent(getApplication(),ContactActivity.class);
        startActivity(intent);
    }









}
